import Vue from "vue";
import Router from "vue-router";
import NotFound from "@/views/NotFound.vue";
import Home from "@/views/Home.vue";
import Article from "@/views/Article.vue";
import Latest from "@/views/Latest.vue";
import Recommend from "@/views/Recommend.vue";
import Collect from "@/views/Collect.vue";
import Like from "@/views/Like.vue";
import Mine from "@/views/Mine.vue";
import Login from "@/views/Login.vue";
import Details from "@/views/Details.vue";
import Register from "@/views/Register.vue";
Vue.use(Router);

export default new Router({
  mode: "history",
  //配置默认类名
  linkActiveClass: "active",

  routes: [
    {
      path: "/",
      redirect: "/login",
    },
    {
      path: "/home",
      component: Home,
      children: [
        {
          path: "/home/",
          redirect: "/home/article",
        },
        {
          path: "/home/article",
          component: Article,
          children: [
            {
              path: "/home/article/",
              redirect: "/home/article/latest",
            },
            {
              path: "/home/article/latest",
              component: Latest,
            },
            {
              path: "/home/article/recommend",
              component: Recommend,
            },
            {
              path: "/home/article/*",
              component: NotFound,
            },
          ],
        },
        {
          path: "/home/collect",
          component: Collect,
        },
        {
          path: "/home/like",
          component: Like,
        },
        {
          path: "/home/mine",
          component: Mine,
        },
        {
          path: "/home/*",
          component: NotFound,
        },
      ],
    },
    {
      path: "/login",
      component: Login,
    },
    {
      path: "/details/:id",
      component: Details,
    },
    {
      path: "/register",
      component: Register,
    },
    {
      path: "*",
      component: NotFound,
    },
  ],
});
